#pragma once

#include "logcplus_fileutil.h"
#include "logcplus_lockutil.h"   

#include "logcplus_string.hpp"
#include "logcplus_types.h"
#include "logcplus_util.h"
#include "logcplus_common.h"
#include "logcplus_layout.h"
#include "logcplus_properties.h"
#include "logcplus_buffer.h"   
#include "logcplus_debug_util.h"
#include "logcplus_log_clean.h"
#include "logcplus_lock.h"
#include "logcplus_easylog.h"
#include "logcplus_base_writer.h" 
#include "logcplus_writer_console.h"
#include "logcplus_writer_syslog.h"
#include "logcplus_writer_file.h"
#include "logcplus_factory.h"
#include "logcplus_logger.h"

#define LOGCPLUS_HANDLE_EX(instanceName)      CLogger::getInstance(instanceName)
#define LOGCPLUS_HANDLE              		  CLogger::getInstance()
#define LOGCPLUS_SETLEVEL(LEVEL)              if(LOGCPLUS_HANDLE) LOGCPLUS_HANDLE->SetLogLevel((logcplus_level_t)LEVEL)
#define LOGCPLUS_SETLAYOUT(LAYOUT)            if(LOGCPLUS_HANDLE) LOGCPLUS_HANDLE->SetLayout(LAYOUT)
#define LOGCPLUS_LOGTYPE(LOGTYPE)             if(LOGCPLUS_HANDLE) LOGCPLUS_HANDLE->SetLogType((logcplus_type_t)LOGTYPE)
#define LOGCPLUS_INIT( LOGNAME   )            if(LOGCPLUS_HANDLE) LOGCPLUS_HANDLE->LogInit(LOGNAME,  LOGCPLUS_DEBUG)
#define LOGCPLUS_BEGIN(LOGMSGID   )           if(LOGCPLUS_HANDLE) LOGCPLUS_HANDLE->LogBegin(LOGMSGID)
#define LOGCPLUS_TRACE(fmt, args...)          if(LOGCPLUS_HANDLE) LOGCPLUS_HANDLE->Logger( LOGMCRO,  LOGCPLUS_TRACE, fmt, ##args)
#define LOGCPLUS_DEBUG(fmt, args...)          if(LOGCPLUS_HANDLE) LOGCPLUS_HANDLE->Logger( LOGMCRO,  LOGCPLUS_DEBUG, fmt, ##args)
#define LOGCPLUS_INFO( fmt, args...)          if(LOGCPLUS_HANDLE) LOGCPLUS_HANDLE->Logger( LOGMCRO,  LOGCPLUS_INFO,  fmt, ##args)
#define LOGCPLUS_WARN( fmt, args...)          if(LOGCPLUS_HANDLE) LOGCPLUS_HANDLE->Logger( LOGMCRO,  LOGCPLUS_WARN,  fmt, ##args)
#define LOGCPLUS_ERROR(fmt, args...)          if(LOGCPLUS_HANDLE) LOGCPLUS_HANDLE->Logger( LOGMCRO,  LOGCPLUS_ERROR, fmt, ##args)
#define LOGCPLUS_FATAL(fmt, args...)          if(LOGCPLUS_HANDLE) LOGCPLUS_HANDLE->Logger( LOGMCRO,  LOGCPLUS_FATAL, fmt, ##args)
#define LOGCPLUS_LOGHEX(LEVEL,LOGMSG,LOGSIZE) if(LOGCPLUS_HANDLE) LOGCPLUS_HANDLE->LogHex( LOGMCRO, LEVEL,LOGMSG,LOGSIZE)
#define LOGCPLUS_COMMIT()                     if(LOGCPLUS_HANDLE) LOGCPLUS_HANDLE->LogCommit()
#define LOGCPLUS_UNINIT()                     if(LOGCPLUS_HANDLE) LOGCPLUS_HANDLE->LogUInit()

#define TRXLOG_HANDLE 	LOGCPLUS_HANDLE
#define TLOG_LOGTYPE   	LOGCPLUS_LOGTYPE
#define TLOG_INIT   	LOGCPLUS_INIT
#define TLOG_BEGIN  	LOGCPLUS_BEGIN
#define TLOG_COMMIT 	LOGCPLUS_COMMIT
#define TLOG_UNINIT 	LOGCPLUS_UNINIT
#define TLOG_TRACE  	LOGCPLUS_TRACE
#define TLOG_DEBUG		LOGCPLUS_DEBUG
#define TLOG_INFO		LOGCPLUS_INFO
#define TLOG_WARN		LOGCPLUS_WARN
#define TLOG_ERROR		LOGCPLUS_ERROR
#define TLOG_FATAL		LOGCPLUS_FATAL
#define TLOG_HEX		LOGCPLUS_LOGHEX

using namespace logcplus;